package com.capri.model.impl;

import com.capri.api.NurseHomeApi;
import com.capri.model.INurse;
import com.capri.model.bean.AllOrdersBean;
import com.capri.model.bean.BaseResultBean;
import com.capri.model.bean.LoginResultBean;
import com.capri.model.bean.OrderDetailBean;
import com.capri.model.bean.OrderNumBean;
import com.capri.model.bean.TodayOrderBean;
import com.capri.model.bean.VerifyCodeResultBean;
import com.capri.utils.CommonSubscriber;
import com.capri.utils.ServiceFactory;
import com.capri.utils.TransformUtils;

import rx.Observable;

public class NurseModel implements INurse {
    @Override
    public Observable<LoginResultBean> login(String username, String password) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).login(username,password).compose(TransformUtils.<LoginResultBean>defaultSchedulers());
    }

    @Override
    public Observable<VerifyCodeResultBean> getVerifyCode(String mobile) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).getVerifyCode(mobile).compose(TransformUtils.<VerifyCodeResultBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseResultBean> resetPwd(String mobile, String code, String password, String confirmPassword) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).resetPwd(mobile,code,password,confirmPassword).compose(TransformUtils.<BaseResultBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseResultBean> modifyPwd(String oldPassword, String newPassword, String newConfirmPassword) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).modifyPwd(oldPassword,newPassword,newConfirmPassword).compose(TransformUtils.<BaseResultBean>defaultSchedulers());
    }

    @Override
    public Observable<AllOrdersBean> GetAllOrders(String serviceStatus) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).GetAllOrders(1000,"",serviceStatus).compose(TransformUtils.<AllOrdersBean>defaultSchedulers());
    }

    @Override
    public Observable<OrderDetailBean> GetOrderDetail(String id) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).GetOrderDetail(id).compose(TransformUtils.<OrderDetailBean>defaultSchedulers());
    }

    @Override
    public Observable<OrderNumBean> GetOrderNum() {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).GetOrderNum().compose(TransformUtils.<OrderNumBean>defaultSchedulers());
    }

    @Override
    public Observable<TodayOrderBean> GetTodayOrder() {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).GetTodayOrder().compose(TransformUtils.<TodayOrderBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseResultBean> UpdateOrderStatus(String id, String serviceStatus) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).UpdateOrderStatus(id,serviceStatus).compose(TransformUtils.<BaseResultBean>defaultSchedulers());
    }

    @Override
    public Observable<BaseResultBean> uploadGeoInfo(String orderId,String longitude, String latitude) {
        return ServiceFactory.GetInstance().createService(NurseHomeApi.class).uploadGeoInfo(orderId,longitude,latitude).compose(TransformUtils.<BaseResultBean>defaultSchedulers());
    }
}
